package com.hspedu.poly_.ployparameter_;


/**
 * @author yulian174
 * @version 1.0
 */
public class PloyParameter {
    public static void main(String[] args) {
        Employee[] employees = new Employee[2];
        employees[0] = new Manager("陈某", 15000, 1500);
        employees[1] = new Pemp("普通工人", 5000);
        employees[0].getAnnual();
        employees[1].getAnnual();
        for (int i = 0; i < employees.length; i++) {
            if (employees[i] instanceof Manager) {
                Manager manager1 = (Manager) employees[i];
                manager1.manage();
            } else if (employees[i] instanceof Pemp) {
                Pemp pemp = (Pemp) employees[i];
                pemp.work();
            }
        }
    }
}

class Employee {
    private String name;
    private double salary;

    public Employee(String name, double salary) {
        this.name = name;
        this.salary = salary;
    }

    public void getAnnual() {
        System.out.println(name + "年工资为：" + salary * 12);
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

}
